<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>拖拽学习</title>
    <style>
      .container {
        width: 300px;
        height: 500px;
        border: 3px dashed;
        margin-bottom: 10px;
      }
      .drag-container {
        width: 300px;

        border: 3px dashed lightcoral;
      }
      .drag {
        height: 50px;
        border: 2px dashed lightgreen;
      }
    </style>
  </head>
  <body>
    <div class="container"></div>

    <div class="drag-container">
      <div class="drag" draggable="true">元素1</div>
      <div class="drag" draggable="true">元素2</div>
      <div class="drag" draggable="true">元素3</div>
      <div class="drag" draggable="true">元素4</div>
    </div>
    <script>
      const dragList = document.querySelectorAll('.drag')
      const target = document.getElementsByClassName('container')

      console.log(dragList)
      console.log(target)
    </script>
  </body>
</html>
